TARGET=bin/test
TARGET_1=bin/TlsfStdString
TARGET_2=bin/TlsfStdString_test1

all: $(TARGET) $(TARGET_1) $(TARGET_2)

GXX=g++
GCC=gcc
CFLAGS=-g

OBJECTS := obj/test.o obj/tlsf.o
OBJECTS_1 := obj/TlsfStdString.o obj/tlsf.o
OBJECTS_2 := obj/TlsfStdString_test1.o obj/tlsf.o

OBJDIR:
		mkdir -p obj

BINDIR:
		mkdir -p bin

obj/test.o: OBJDIR tests/test.cpp tlsf/tlsf.h Makefile
		$(GXX) -c $(CFLAGS) -o obj/test.o tests/test.cpp -Itlsf

obj/TlsfStdString.o: OBJDIR tests/TlsfStdString.cpp tlsf/tlsf.h Makefile
		$(GXX) -c $(CFLAGS) -o obj/TlsfStdString.o tests/TlsfStdString.cpp -Itlsf

obj/TlsfStdString_test1.o: OBJDIR tests/TlsfStdString_test1.cpp tlsf/tlsf.h Makefile
		$(GXX) -c $(CFLAGS) -o obj/TlsfStdString_test1.o tests/TlsfStdString_test1.cpp -Itlsf

obj/tlsf.o: OBJDIR tlsf/tlsf.c tlsf/tlsf.h Makefile
		$(GCC) -c $(CFLAGS) -o obj/tlsf.o tlsf/tlsf.c -Itlsf

$(TARGET): BINDIR $(OBJECTS) Makefile
		$(GXX) $(CFLAGS) -o $(TARGET) $(OBJECTS)

$(TARGET_1): BINDIR $(OBJECTS_1) Makefile
		$(GXX) $(CFLAGS) -o $(TARGET_1) $(OBJECTS_1)

$(TARGET_2): BINDIR $(OBJECTS_2) Makefile
		$(GXX) $(CFLAGS) -o $(TARGET_2) $(OBJECTS_2) -lpthread
		